<?php
$this->breadcrumbs=array(
	'作者'=>array('index'),
	$model->username,
);


if ($model->id == Yii::app()->user->id){
	$this->menu=array(
		array('label'=>'更新个人信息', 'url'=>array('update', 'id'=>$model->id)),
		array('label'=>'修改本人密码', 'url'=>array('changepwd', 'id'=>$model->id))
	);
}

$this->manual=array(
	array('label'=>'如何创建内容', 'url'=>array('index')),
	array('label'=>'如何创建故事', 'url'=>array('create')),
	array('label'=>'如何添加链接', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'如何加入工作室', 'url'=>array('changepwd', 'id'=>$model->id)),
	array('label'=>'如何查看积分', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'如何参与社区', 'url'=>array('admin')),
);
?>

<span class = "span-16">
<h1><?php echo $model->username; ?></h1>
</span>
<?php 
	if ($model->id != Yii::app()->user->id and HandleBox::isUserHelper($model->id) == false){
		echo '<span class = "span-4 last" style = "text-align: right;">';
		echo CHtml::link('申请成为合作者', array('apply', 'type'=>'helper', 'id'=>$model->id));
		echo '</span>';
	} 
	elseif (HandleBox::isUserHelper($model->id) == true){
		echo '<span class = "span-4 last" style = "text-align: right;">他是你的合作者 ';
		echo CHtml::link('取消', array('apply', 'type'=>'unhelper', 'id'=>$model->id));
		echo '</span>';
	}
?>

<div class = "span-20 last">
	<table class = "detail-view">
		<tr class = "odd">
			<th>角色</th>
			<td><?php echo $model->roleText; ?></td>
			<th width = "80px">星级</th>
			<td><?php echo $model->star; ?></td>
			<th>QQ</th>
			<td><?php echo $model->qq; ?></td>
		</tr>
		<tr class = "even">
			<th>状态</th>
			<td><?php echo $model->statusText; ?></td>
			<th width = "80px">性别</th>
			<td><?php echo $model->sexText; ?></td>
						<th>Email</th>
			<td><?php echo $model->email; ?></td>
		</tr>
		<tr class = "odd">
			<th width = "80px">贡献值</th>
			<td><?php echo $model->score; ?></td>
			<th width = "80px">年龄</th>
			<td>
				<?php
					if ($model->birthday){ 
						echo floor((time()-$model->birthday)/31536000).'岁';
					}
					else{
						echo "未知";
					}
				?>
			</td>
			<th>注册时间</th>
			<td><?php echo date("Y-m-d H:i",$model->reg_time); ?></td>
		</tr>
	</table>
</div>
<div class = "clear"></div>
<div style = "border-top: 5px #CCC solid; background: #F7F7F7; padding: 10px;">
	<?php echo $model->description; ?>
</div>

<br />

<div class = "span-10">
	<div class = "span-8" >
		<h2>创建的作品</h2>
	</div>
	<div class = "span-2 last">
		<?php echo CHtml::link('更多>>',array('more', 'id'=>$model->id)); ?>
	</div>
	<div class = "clear"></div>
	<div>
		<ul >
		<?php 
			foreach ($create->data as $value){
				echo "<li>".CHtml::link($value->title, array('/node/view', 'id'=>$value->id))."</li>";
			}
		?>
		</ul>
	</div>
</div>

<div class = "span-10 last">
	<div class = "span-8" >
		<h2>参与的作品</h2>
	</div>
	<div class = "span-2 last">
		<?php echo CHtml::link('更多>>',array('participate', 'id'=>$model->id,)); ?>
	</div>
	<div class = "clear"></div>
	<div>
		<ul >
		<?php 
			foreach ($create->data as $value){
				echo "<li>".CHtml::link($value->title, array('/node/view', 'id'=>$value->id))."</li>";
			}
		?>
		</ul>
	</div>
</div>
